;
! function($) {
    //页面数据渲染--新品首发内容

    $.ajax({
        url: 'http://10.31.158.42/javascript/projectname/php/goodsdata.php',
        dataType: 'json'
    }).done(function(headdata) {
        const $oUl = $('.newBox ul');
        var strhtml = "";
        //let strtitle = '';
        //let $title = ('head title');
        $.each(headdata, function(index, value) {
            strhtml += `<li>
            <a href="http://10.31.158.42/javascript/projectname/src/details.html?sid=${value.sid}">
			<img src="${value.img}"/>
			<p>
			<span>${value.title}</span>
			<i>￥${value.price}</i>
            </p>
            </a>
            </li>`;
            //$strtitle = `${value.title}`;
        });
        //$(window.title).html($strtitle);
        $oUl.html(strhtml);
    });


    //页面数据渲染--喜欢内容
    $.ajax({
        url: "http://10.31.158.42/javascript/projectname/php/goodsdata2.php",
        dataType: 'json',
    }).done(function(likedata) {
        const $oUl = $('.Like ul');
        let strhtml = "";
        $.each(likedata, function(index, value) {
            strhtml += `
            <li>
			<img src="${value.img}">
			<p>
			<span>${value.title}</span>
			<i>￥${value.price}</i>
            </p>
            
			</li>
			`;
        });
        $oUl.html(strhtml);
    });


    //页面渲染--推荐内容
    $.ajax({
        url: "http://10.31.158.42/javascript/projectname/php/goodsdata3.php",
        dataType: 'json',
    }).done(function(tuijiandata) {
        const $oUl = $('.goodsBox .leftR ul');
        let strhtml = "";
        $.each(tuijiandata, function(index, value) {
            strhtml += `
			<li>
			<a href="#">
            <img src="${value.img}"  >
			<p>
				${value.title}
			</p>
			</li>
		</a>`;
        });
        $oUl.html(strhtml);
    });


    //页面渲染--热卖产品
    $.ajax({
        url: "http://10.31.158.42/javascript/projectname/php/goodsdata4.php",
        dataType: 'json',
    }).done(function(remaidata) {
        let strhtml = "";
        const $oUl = $('.newBox2 ul');
        $.each(remaidata, function(index, value) {
            strhtml += `<li>
            <img class="lazy" data-original="${value.img}" width="190" height="190">
                <span>${value.title}</span>
				<i>￥${value.price}</i>
				</li>
				`;
        });
        $oUl.html(strhtml);
        $(function() {
            $("img.lazy").lazyload({
                effect: "fadeIn"
            });
        });
    });
}(jQuery);